import request from '../../http'

const URL = {
	LOGIN: '/wx_login',
	LOGOUT: '/wx_logout',
	// 工资条
	// SALARYTYPE_SELECT: '/salaryType/select',
	// SALARYTYPE_INSERT: '/salaryType/insertCustom',
	// SALARYTYPE_DELETE: '/salaryType/delete',
	// THANKS_SELECT: '/thanks/select',
	// THANKS_INSERT: '/thanks/insertCustom',
	// THANKS_DELETE: '/thanks/delete',
	// PAYROLL_SET_INFO: '/payrollSet/selectInfo',
	// PAYROLL_SET_EDIT: '/payrollSet/edit',
	// PAYROLL_CONFIRM_REMINDER_ADD: '/payrollConfirmReminder/add',
	// PAYROLL_CONFIRM_REMINDER_EDIT: '/payrollConfirmReminder/edit',
	// PAYROLL_CONFIRM_REMINDER_REMOVE: '/payrollConfirmReminder/remove',
	// PAYROLL_GRANT_REMINDER_ADD: '/payrollGrantReminder/add',
	// PAYROLL_GRANT_REMINDER_EDIT: '/payrollGrantReminder/edit',
	// PAYROLL_GRANT_REMINDER_REMOVE: '/payrollGrantReminder/remove',
	// PAYROLL_ADD_SAVE: '/payroll/addSave',
	// PAYROLL_LIST: '/payroll/getList',
	// PAYROLL_VERIFY_REMOVE: '/payroll/verifyRemove',
	// PAYROLL_REMOVE: '/payroll/remove',
	// PAYROLL_RECORDS: '/payroll/payrollRecords',
	// PAYROLL_SELECT_H5: '/payroll/selectH5',
	// PAYROLL_DETAILS_LIST: '/payrollDetails/list',
	// PAYROLL_DETAILS_SEND: '/payrollDetails/send',
	// PAYROLL_DETAILS_SEND_ALL: '/payrollDetails/sendAll',
	// PAYROLL_DETAILS_WITHDRAW: '/payrollDetails/withdraw',
	// PAYROLL_DETAILS_WITHDRAW_ALL: '/payrollDetails/withdrawAll',
	// PAYROLL_DETAILS_GETDATA: '/payrollDetails/getData',
	// PAYROLL_DETAILS_UPDATA: '/payrollDetails/upData',
	// PAYROLL_DETAILS_EXPORT: '/payrollDetails/export',
	// PAYROLL_MODIFY_HISTORY: '/payrollModifyHistory/mapList',

	// 事物管理
	THINGS_LIST_DEP: '/things/listDep',
	THINGS_LIST_USER: '/things/listUser',
	THINGSADD: '/things',
	THINGSINQUIRE: '/things',
	THINGSUPDATE: '/things',
	THINGSREMOVE: '/things',
	// 预约场馆
	APPOINMENTS_SITES: '/appointments/sites/listApp',
	VIEW_AVAILABLE_DEFINITION: '/processDefinitions/listProcess',
	APPOINMENTS_SITES_LIST_OPT: '/appointments/sites/listOpt',
	APPOINMENTS_DICT_GET_TYPE: '/appointment/dict/room/getType', // 查询房间分类
	APPOINMENTS_PROCESSES: '/appointments/processes',
	APPOINMENTS_TASKS_LIST_TODO: '/appointments/tasks/list/todo',
	APPOINMENTS_TASKS_COMPLETE: '/appointments/tasks/complete',
	APPOINMENTS_TASKS_LIST_DONE: '/appointments/tasks/list/done',
	APPOINMENT_ROOMS: '/appointment/rooms/', // 查询房间名称
	APPOINMENT_ROOMS_ID: '/appointment/rooms/', // 查询房间编号
	APPOINMENT_ROOMS_LISTBUILDING: '/appointment/rooms/listBuilding', // 查询所属楼栋
	APPOINMENT_ROOMS_ADD: '/appointment/rooms/add', // 预约管理增加
	APPOINMENT_CUSTOMER_ROOMS_LIST: '/appointment/customer/rooms/list', // 查看房间的预约详情
	APPOINMENT_TASKS_LIST_TODO: '/appointment/taskes/list/todo', //查看当前待办任务
	APPOINMENT_TASKS_COMPLETE: '/appointment/taskes/complete', // 审批
	// APPOINMENT_CUSTOMER_ROOMS_LIST_CUSTOMER_ROOM_APP: '/appointment/customer/rooms/listCustomerRoomApp', // 查看待办
	APPOINMENT_CUSTOMER_ROOMS_LISTS: '/appointment/customer/rooms/list', // 查看待办
	APPOINMENT_ROOMS_LIST: '/appointment/rooms/list', // 查看可预约详情
	APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPP: '/appointment/customer/rooms/listCustomerRoomApp', // 查看用户已经预约的信息
	APPOINMENTS_TASKS_ADD: '/appointment/taskes/add', // 用户预约场地
	APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPPTIMESCOPE: '/appointment/customer/rooms/listCustomerRoomAppTimeScope', // 查看该场馆可预约时间段
}

export const userLogin = ({
	code,
	state
}) => request(URL.LOGIN, 'POST', {
	code,
	state
})

export const userLogout = () => request(URL.LOGOUT, 'POST')

// 薪资类型查询
export const postSalaryTypeSelect = () => request(URL.SALARYTYPE_SELECT, 'POST')

// 薪资类型添加
export const postSalaryTypeInsert = ({
		sstName
	}) =>
	request(URL.SALARYTYPE_INSERT, 'POST', {
		sstName
	})

// 薪资类型删除
export const postSalaryTypeDelete = ({
	sstId
}) => request(URL.SALARYTYPE_DELETE, 'POST', {
	sstId
})

// 薪资类型查询
export const postThanksSelect = () => request(URL.THANKS_SELECT, 'POST')

// 薪资类型添加
export const postThanksInsert = ({
	thanks
}) => request(URL.THANKS_INSERT, 'POST', {
	thanks
})

// 薪资类型删除
export const postThanksDelete = ({
	id
}) => request(URL.THANKS_DELETE, 'POST', {
	id
})

// 工资条设置查询
export const postPayrollSetInfo = () => request(URL.PAYROLL_SET_INFO, 'POST')

// 工资条设置修改
export const postPayrollSetFeedbackSettings = ({
		feedbackSettings
	}) =>
	request(
		URL.PAYROLL_SET_EDIT,
		'POST', {
			feedbackSettings
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

export const postPayrollSetAutoConfirmationSettings = ({
		autoConfirmationSettings
	}) =>
	request(
		URL.PAYROLL_SET_EDIT,
		'POST', {
			autoConfirmationSettings
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

export const postPayrollSetAutoConfirmationDays = ({
		autoConfirmationDays
	}) =>
	request(
		URL.PAYROLL_SET_EDIT,
		'POST', {
			autoConfirmationDays
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

// 工资条确认提醒
export const postPayrollConfirmReminderAdd = ({
		days
	}) =>
	request(URL.PAYROLL_CONFIRM_REMINDER_ADD, 'POST', {
		days
	})

export const postPayrollConfirmReminderEdit = ({
		spcrId,
		reminderDay
	}) =>
	request(
		URL.PAYROLL_CONFIRM_REMINDER_EDIT,
		'POST', {
			spcrId,
			reminderDay
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

export const postPayrollConfirmReminderRemove = ({
		ids
	}) =>
	request(URL.PAYROLL_CONFIRM_REMINDER_REMOVE, 'POST', {
		ids
	})

// 工资条发放提醒
export const postPayrollGrantReminderAdd = ({
		monthlyWageDays,
		reminderDay
	}) =>
	request(
		URL.PAYROLL_GRANT_REMINDER_ADD,
		'POST', {
			monthlyWageDays,
			reminderDay
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

export const postPayrollGrantReminderEdit = ({
		spcrId,
		monthlyWageDays,
		reminderDay
	}) =>
	request(
		URL.PAYROLL_CONFIRM_REMINDER_EDIT,
		'POST', {
			spcrId,
			monthlyWageDays,
			reminderDay
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

export const postPayrollGrantReminderRemove = ({
		ids
	}) =>
	request(URL.PAYROLL_CONFIRM_REMINDER_REMOVE, 'POST', {
		ids
	})

// 工资条添加
export const postPayrollAddSave = ({
		sendHeader,
		burnAfterReading,
		sendingMethod,
		salaryMonth,
		salaryType,
		thanksStart,
		thanksEnd,
		warmTips,
		whetherToSend,
		hideEmpty,
		hideZero
	}) =>
	request(
		URL.PAYROLL_ADD_SAVE,
		'POST', {
			sendHeader,
			burnAfterReading,
			sendingMethod,
			salaryMonth,
			salaryType,
			thanksStart,
			thanksEnd,
			warmTips,
			whetherToSend,
			hideEmpty,
			hideZero
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

// 工资条查询
export const postPayrollList = ({
		salaryTitle,
		sendStartTime,
		sendEndTime,
		pageNum,
		pageSize
	}) =>
	request(
		URL.PAYROLL_LIST,
		'POST', {
			salaryTitle,
			sendStartTime,
			sendEndTime,
			pageNum,
			pageSize
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

// 删除校验
export const postPayrollVerifyRemove = ({
		id
	}) =>
	request(URL.PAYROLL_VERIFY_REMOVE, 'POST', {
		id
	})

// 工资条删除
export const postPayrollRemove = ({
	id
}) => request(URL.PAYROLL_REMOVE, 'POST', {
	id
})

// 工资条详情
export const postPayrollDetailsList = ({
		id,
		pageNum,
		pageSize
	}) =>
	request(URL.PAYROLL_DETAILS_LIST, 'POST', {
		id,
		pageNum,
		pageSize
	})

// 工资条发送
export const postPayrollDetailsSend = ({
		spdId,
		spmId
	}) =>
	request(URL.PAYROLL_DETAILS_SEND, 'POST', {
		spdId,
		spmId
	})

// 工资条全部发送
export const postPayrollDetailsSendAll = ({
		spmId
	}) =>
	request(URL.PAYROLL_DETAILS_SEND_ALL, 'POST', {
		spmId
	})

// 工资条撤回
export const postPayrollDetailsWithdraw = ({
		spdId,
		spmId
	}) =>
	request(URL.PAYROLL_DETAILS_WITHDRAW, 'POST', {
		spdId,
		spmId
	})

// 工资条全部撤回
export const postPayrollDetailsWithdrawAll = ({
		spmId
	}) =>
	request(URL.PAYROLL_DETAILS_WITHDRAW_ALL, 'POST', {
		spmId
	})

// 查看员工工资条详情
export const postPayrollDetailsGetData = ({
		spmId,
		userAccount,
		importType
	}) =>
	request(URL.PAYROLL_DETAILS_GETDATA, 'POST', {
		spmId,
		userAccount,
		importType
	})

// 更新员工工资条详情
export const postPayrollDetailsUpData = ({
		spmId,
		userAccount,
		importType,
		payrollParseVos = []
	}) =>
	request(
		URL.PAYROLL_DETAILS_UPDATA,
		'POST', {
			spmId,
			userAccount,
			importType,
			payrollParseVos
		}, {
			headers: {
				'Content-Type': 'application/json;charset=UTF-8'
			}
		}
	)

// // 导出工资条详情
// export const postPayrollDetailsExport = ({ ids, spmId }) =>
// 	request(URL.PAYROLL_DETAILS_EXPORT, 'POST', { ids, spmId })

// 获取工资条相关信息
export const postPayrollSelectH5 = ({
		spmId,
		userAccount
	}) =>
	request(URL.PAYROLL_SELECT_H5, 'POST', {
		spmId,
		userAccount
	})

// 获取工资条相关信息
export const postPayrollRecords = () => request(URL.PAYROLL_RECORDS, 'POST')

// 获取工资条修改历史
export const postPayrollModifyHistory = ({
	spmId
}) => request(URL.PAYROLL_MODIFY_HISTORY, 'POST', {
	spmId
})
// ---------------------------------------------------------场馆预约------------------------------------------------
// 字典查询类型 √
export const getType = ({
	dictType
}) => request(URL.APPOINMENTS_DICT_GET_TYPE, 'GET', {
	dictType
})

//查看可预约场馆 √ 
export const appoinmentsSites = ({
	type,
	siteType,
	startTime,
	endTime,
	pageNum,
	pageSize
}) => request(URL.APPOINMENTS_SITES, 'GET', {
	type,
	siteType,
	startTime,
	endTime,
	pageNum,
	pageSize
})

// 查看所有流程定义
export const viewAvailableDefinition = () => request(URL.VIEW_AVAILABLE_DEFINITION, 'GET')

// 查看用户已经预约信息
export const appoinmentsSitesListOpt = ({
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	pageNum,
	pageSize
}) => request(URL.APPOINMENTS_SITES_LIST_OPT, 'GET', {
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	pageNum,
	pageSize
})

// 新增预约 √
export const appoinmentProcesses = ({
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	appRemark,
	siteId
}) => request(URL.APPOINMENTS_PROCESSES, 'POST', {
	appSiteName,
	appAddress,
	appType,
	appSiteType,
	appStartTime,
	appEndTime,
	appRemark,
	siteId
}, {
	headers: {
		'Content-Type': 'application/json;charset=UTF-8'
	}
})

// 查看当前代办任务
export const appoinmentsTasksListTodo = ({
	pageNum,
	pageSize
}) => request(URL.APPOINMENTS_TASKS_LIST_TODO, 'GET', {
	pageNum,
	pageSize
})

// 审批
export const appoinmentsTasksComplete = ({
	taskId,
	agree
}) => request(URL.APPOINMENTS_TASKS_COMPLETE, 'POST', {
	taskId,
	agree
}, {
	headers: {
		'Content-Type': 'application/json;charset=UTF-8'
	}
})

// 查询楼栋 APPOINMENT_ROOMS_LISTBUILDING
export const appoinmentRoomsListBuilding = () => request(URL.APPOINMENT_ROOMS_LISTBUILDING, 'GET')

// 查询房间名称 APPOINMENT_ROOMS
export const appoinmentRooms = ({
	buildingId,
	roomType
}) => request(URL.APPOINMENT_ROOMS, 'GET', {
	buildingId,
	roomType
})

// 查询房间编号 APPOINMENT_ROOMS_ID
export const appoinmentRoomsId = ({
	roomName,
	buildingId,
	roomType
}) => request(URL.APPOINMENT_ROOMS_ID, 'GET', {
	roomName,
	buildingId,
	roomType
})

// 预约管理增加 APPOINMENT_ROOMS_ADD
export const appoinmentRoomsAdd = ({
	roomName,
	roomId,
	roomType,
	buildingName,
	roomStatus,
	appApprover,
	roomAppTime
}) => request(URL.APPOINMENT_ROOMS_ADD, 'POST', {
	roomName,
	roomId,
	roomType,
	buildingName,
	roomStatus,
	appApprover,
	roomAppTime
}, {
	headers: {
		'Content-Type': 'application/json;charset=UTF-8'
	}
})

// 查看房间的预约详情 APPOINMENT_CUSTOMER_ROOMS_LIST
export const appoinmentCustomerRoomsList = ({
	roomAppId,
	roomAppTimeId
}) => request(URL.APPOINMENT_CUSTOMER_ROOMS_LIST, 'GET', {
	roomAppId,
	roomAppTimeId
})

// 查看当前代办任务 APPOINMENT_TASKS_LIST_TODO
export const appoinmentTasksListTodo = ({
	pageNum,
	pageSize
}) => request(URL.APPOINMENT_TASKS_LIST_TODO, 'GET', {
	pageNum,
	pageSize
})

// 审批 APPOINMENT_TASKS_COMPLETE
export const appoinmentTasksComPlete = ({
	taskId,
	agree
}) => request(URL.APPOINMENT_TASKS_COMPLETE, 'POST', {
	taskId,
	agree
})

// 查看用户已经预约的信息 APPOINMENT_CUSTOMER_ROOMS_LISTS
export const appoinmentCustomerRoomsLists = ({
	roomAppId,
	roomAppTimeId
}) => request(URL.APPOINMENT_CUSTOMER_ROOMS_LISTS, 'GET', {
	roomAppId,
	roomAppTimeId
})

// 查看可预约详情 APPOINMENT_ROOMS_LIST
export const appoinmentRoomsLists = () => request(URL.APPOINMENT_ROOMS_LIST, 'GET')

// 查看用户已经预约的信息 APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPP
export const appoinmentRoomsListCustomerRoomApp = () => request(URL.APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPP, 'GET')

// 用户预约场馆 APPOINMENTS_TASKS_ADD
export const appoinmentTasksAdd = ({
	customerRoomAppName,
	customerRoomAppTimeScope,
	customerRoomAppDate,
	customerRoomAppUsername,
	customerRoomAppApprover,
	customerRoomAppEquipment,
	customerRoomAppRemark,
	roomAppTimeScope,
	roomAppId,
	roomAppTimeId,
	customerRoomAppType
}) => request(URL.APPOINMENTS_TASKS_ADD, 'POST', {
	customerRoomAppName,
	customerRoomAppTimeScope,
	customerRoomAppDate,
	customerRoomAppUsername,
	customerRoomAppApprover,
	customerRoomAppEquipment,
	customerRoomAppRemark,
	roomAppTimeScope,
	roomAppId,
	roomAppTimeId,
	customerRoomAppType
}, {
	headers: {
		'Content-Type': 'application/json;charset=UTF-8'
	}
})

// APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPPTIMESCOPE
export const appoinmentCustomerRoomsListCustomerRoomAppTimeScope = ({
	roomAppId,
	roomAppTimeId
}) => request(URL.APPOINMENT_CUSTOMER_ROOMS_LISTCUSTOMERROOMAPPTIMESCOPE, 'GET', {
	roomAppId,
	roomAppTimeId
})











// 查看已办
export const appoinmentsTasksListDone = ({
	pageNum,
	pageSize
}) => request(URL.APPOINMENTS_TASKS_LIST_DONE, 'GET', {
	pageNum,
	pageSize
})

// 新增事物
export const thingsAdd = ({
	thingName,
	userId,
	thingStatus,
	thingUsername
}) => request(URL.THINGSADD, 'POST', {
	thingName,
	userId,
	thingStatus,
	thingUsername
})

// 查询事物
export const thingsInquire = ({
	pageNum,
	pageSize,
	thingsName,
	thingsStatus
}) => request(URL.THINGSINQUIRE, 'GET', {
	pageNum,
	pageSize,
	thingsName,
	thingsStatus
})

// 更新事物
export const thingsUpdate = ({
	thingId,
	thingName,
	userId,
	thingStatus,
	thingUsername
}) => request(URL.THINGSUPDATE, 'PUT', {
	thingId,
	thingName,
	userId,
	thingStatus,
	thingUsername
}, )

// 删除事物
export const thingsRemove = ({
	thingIds
}) => request(URL.THINGSREMOVE, 'DELETE', {
	thingIds
})

// 事物管理
export const thingsListDep = () => request(URL.THINGS_LIST_DEP, 'GET')

// 用户查询
export const thingsListUser = ({
	depId
}) => request(URL.THINGS_LIST_USER, 'GET', {
	depId
})